/*
 * @Author: xiaozhuang-c-language 3535851673@qq.com
 * @Date: 2025-07-10 22:52:32
 * @LastEditors: xiaozhuang-c-language 3535851673@qq.com
 * @LastEditTime: 2025-07-10 23:13:24
 * @FilePath: /zhuang/http-v1/mudo/test/client4.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include"../source/server.hpp"
//同时多个请求测试

int main()
{
    Socket cli_sock;
    bool ret = cli_sock.CreateClient(8085,"127.0.0.1");
    if(ret == false)
    {
        ERR_LOG("create newlink error");
        abort();
    }
    cout << "Create Client Success"<< endl;
    string str = "GET /hello HTTP/1.1\r\nConnection:keep-alive\r\nContent-Length:0\r\n\r\n";
    str += "GET /hello HTTP/1.1\r\nConnection:keep-alive\r\nContent-Length:0\r\n\r\n";
    str += "GET /hello HTTP/1.1\r\nConnection:keep-alive\r\nContent-Length:0\r\n\r\n";
    while(1)
    {
        assert(cli_sock.Send(str.c_str(),str.size())!=-1);
        char buf[1024] = {0};
        assert(cli_sock.Recv(buf,1023));
        DBG_LOG("[%s]",buf);
        sleep(12);
    }
    cli_sock.Close();
}